<template>
	<view>
		<!-- 懒加载动画 -->
		<view class="loading-box">
		  <u-loading :show="loadingone" color="#41ADBA" size="70"></u-loading>
		</view>
		<view v-show="!loadingone">
			<navbar name="添加新设备"></navbar>
			<view  hover-class="actaveborder" class="facility-view" v-for="(item,idx) in allfacility"
				:key="idx" @click="nav(item,idx,'search')">
				<view class="facility-image">
					<u-lazy-load border-radius="10" height="100" img-mode="aspectFill"
						:image="item.equipmentIcon"></u-lazy-load>
				</view>
				<view class="facility-body">
					<view class="facility-title">
						{{item.equipmentName}}
					</view>
					{{item.remark}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uLoading from "@/uview-ui/components/u-loading/u-loading.vue"

import uLazyLoad from "@/uview-ui/components/u-lazy-load/u-lazy-load.vue"
	export default {
		components: {
			uLoading,
			uLazyLoad
		},
		data() {
			return {
				loadingone:false,
				allfacility: []
			}
		},
		onLoad() {
			this.newListAll()
		},
		methods: {
			newListAll() {
				this.loadingone = true;
				let _this = this;
				// uni.getStorageSync(global.IS_DEV?'USER_DATA_BSY_T':'USER_DATA_BSY_Z').userId
				this.$api.get(global.apiUrls.newListAll + '?userId='+ uni.getStorageSync(global.IS_DEV?'USER_DATA_BSY_T':'USER_DATA_BSY_Z').userId+'&keyword=&pageCurrent=1&pageSize=100', {})
					.then(res => {
						let records = res.data.result.records;
						_this.allfacility = records
						_this.loadingone = false;
					}).catch(err => {})
			},
			nav(item,index,e) {
				this.$urouter.navigateTo({
					url: '/pagesMy/my/equipment/search',
					params: {
						equipmentIcon: item.equipmentIcon,
						equipmentName:item.equipmentName,
						remark:item.remark,
						equipmentId:item.equipmentId
					}
				});

				// uni.navigateTo({
				// 	url: '/pagesMy/my/equipment/search?equipmentIcon='+item.equipmentIcon+'&equipmentName='+item.equipmentName+'&remark='+item.remark
				// })
			}
		}
	}
</script>

<style lang="scss">
	.actaveborder {
		border: 2upx solid #2EA7E0;
	}

	.facility-view {
		width: 702upx;
		height: 134upx;
		background: #fff;
		margin: 30upx auto 0;
		border-radius: 16upx;
		display: flex;
		padding: 20upx 17upx;

		.facility-image {
			width: 100upx;
			height: 100upx;
			margin-right: 20upx;
		}

		.facility-body {
			font-size: 24upx;
			font-weight: 400;
			color: #9B9B9B;
			line-height: 33upx;

			.facility-title {
				font-size: 30upx;
				font-weight: 500;
				color: #2EA7E0;
				line-height: 48upx
			}
		}
	}
</style>
